﻿<%@ Page Title="" Language="VB" MasterPageFile="~/Articles.master" AutoEventWireup="false" CodeFile="ArticleDetails.aspx.vb" Inherits="ArticleDetails" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:Button ID="btnLike" runat="server" Text="Like!" />
    <asp:Label ID="lblMessage" runat="server" Text="You Liked this Article"></asp:Label>
    <asp:DetailsView ID="DVArticles" runat="server" Height="50px" Width="389px" 
        DataSourceID="DSArticleDetails" AutoGenerateRows="False" 
    DataKeyNames="ID">
        <Fields>
            <asp:BoundField DataField="Author" HeaderText="Author" 
                SortExpression="Author" />
            <asp:BoundField DataField="Content" HeaderText="Content" 
                SortExpression="Content" />
            <asp:BoundField DataField="Topic" HeaderText="Topic" SortExpression="Topic" />
            <asp:BoundField DataField="Title" HeaderText="Title" 
                SortExpression="Title" />
            <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" 
                ReadOnly="True" SortExpression="ID" />
            <asp:BoundField DataField="DateSubmitted" HeaderText="DateSubmitted" 
                SortExpression="DateSubmitted" />
        </Fields>
    </asp:DetailsView>
    <br />
    <asp:SqlDataSource ID="DSArticleDetails" runat="server" 
    ConnectionString="<%$ ConnectionStrings:myFirstDatabase %>" 
    ProviderName="<%$ ConnectionStrings:myFirstDatabase.ProviderName %>" 
    SelectCommand="SELECT DISTINCT * FROM [QArticleDetails] WHERE ([ID] = ?)">
        <SelectParameters>
            <asp:QueryStringParameter Name="ID" QueryStringField="ID" Type="Int32" />
        </SelectParameters>
</asp:SqlDataSource>
    <br />
    <fieldset>
        <legend>Total Comments</legend>
        <asp:ScriptManager ID="SM" runat="server">
        </asp:ScriptManager>
        <asp:UpdateProgress ID="UProgress" runat="server">
        <ProgressTemplate>
            <img src="pix/ajax-loader.gif" alt="Please Wait..."/>
        </ProgressTemplate>
        </asp:UpdateProgress>
        <asp:UpdatePanel ID="UPanel" runat="server">
        <Triggers>
        <asp:AsyncPostBackTrigger ControlID="btnComment" />
        </Triggers>
        <ContentTemplate>
        
        <asp:GridView ID="CommentsTotal" runat="server" AutoGenerateColumns="False" 
            DataKeyNames="Articles" DataSourceID="DSCommentsTotal">
            <Columns>
                <asp:BoundField DataField="Comments" HeaderText="Comments" 
                    SortExpression="Comments" />
                <asp:HyperLinkField DataNavigateUrlFields="Articles" 
                    DataNavigateUrlFormatString="ArticleCommentsView.aspx?id={0}" 
                    HeaderText="View Comments" Text="More..." />
            </Columns>
        </asp:GridView>
        <br />
        <asp:SqlDataSource ID="DSCommentsTotal" runat="server" 
            ConnectionString="<%$ ConnectionStrings:myFirstDatabase %>" 
            ProviderName="<%$ ConnectionStrings:myFirstDatabase.ProviderName %>" 
            SelectCommand="SELECT * FROM [QArtComTot] WHERE ([Articles] = ?)">
            <SelectParameters>
                <asp:QueryStringParameter Name="Articles" QueryStringField="ID" Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
        </ContentTemplate>
        </asp:UpdatePanel>
        <!---->
        </fieldset>
        <br />
<fieldset>
<legend>Tag Article</legend>
	<div>
		<form action="" method="post">
        <asp:CheckBoxList ID="cbListTag" runat="server" DataSourceID="DSTag" 
            DataTextField="Tag" DataValueField="ID" RepeatDirection="Horizontal">
        </asp:CheckBoxList>
        <asp:Label ID="lblTag" runat="server" Text="Add New Tag"></asp:Label><asp:TextBox
            ID="tbTag" runat="server"></asp:TextBox><br />
        <asp:SqlDataSource ID="DSTag" runat="server" 
            ConnectionString="<%$ ConnectionStrings:myFirstDatabase %>" 
            ProviderName="<%$ ConnectionStrings:myFirstDatabase.ProviderName %>" 
            SelectCommand="SELECT DISTINCT * FROM [tblTagArticle] WHERE ([Tag] &lt;&gt; ?)">
            <SelectParameters>
                <asp:Parameter DefaultValue="&quot; &quot;" Name="Tag" Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
        <br />
        <asp:Button ID="Button1" runat="server" Text="Tag It!" />
        </form>
        </div>
       
 </fieldset>
 <br />

     <asp:GridView ID="GridView1" runat="server" AllowSorting="True" 
         AutoGenerateColumns="False" DataSourceID="DSComments">
         <Columns>
             <asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
             <asp:BoundField DataField="Comments" HeaderText="Comments" 
                 SortExpression="Comments" />
         </Columns>
     </asp:GridView>
     <asp:SqlDataSource ID="DSComments" runat="server" 
         ConnectionString="<%$ ConnectionStrings:myFirstDatabase %>" 
         ProviderName="<%$ ConnectionStrings:myFirstDatabase.ProviderName %>" 
         SelectCommand="SELECT * FROM [QArtComm] WHERE ([tblArticles.ID] = ?)">
         <SelectParameters>
             <asp:QueryStringParameter Name="column1" QueryStringField="ID" Type="Int32" />
         </SelectParameters>
     </asp:SqlDataSource>
		<form action="" class ="input-frm" method="post">
      
    <h1>Add a Comment!
        <span>Please fill all the texts in the fields.</span>
    </h1>
    <label>
        <span> Title :</span>
        <asp:TextBox ID="txtTitle" runat="server"></asp:TextBox><br />
    </label>
    
      <label>
        <span>Comment :</span> 
        <asp:TextBox ID="txtcomment" runat="server" TextMode="MultiLine"></asp:TextBox><br />
    </label> 
   
     <label>
        <span>&nbsp;</span> 
        <asp:Button ID="btnComment" runat="server" Text="Add Comment!" />
    </label>    
</form>
</asp:Content>

